import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type DepartDocument = Depart & Document;

@Schema({
  timestamps: {
    createdAt: 'createdAt',
    updatedAt: 'updatedAt',
  },
})
export class Depart extends Document {
  // 部门名称
  @Prop({ type: String })
  departName: string;

  // 父部门id
  @Prop({ type: String, default: 0 })
  parentId: string;

  // 排序
  @Prop({ type: Number, default: 0 })
  sort: number;

  // 是否删除
  @Prop({ type: Boolean, default: false })
  isDelete: false;
}

export const DepartSchema = SchemaFactory.createForClass(Depart);
